<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="UTF-8">
		<meta http-equiv="Expires" content="0">
    <meta http-equiv="Pragma" content="no-cache">
    <meta http-equiv="Cache-control" content="no-cache,no-store,must-revalidate">
    <meta http-equiv="Cache" content="no-cache">
		<title>查看详情</title>
		<link rel="stylesheet" href="../../../component/pear/css/pear.css" />
	</head>
	<body>
		<div class="mainBox">
			<div class="main-container">
				<div class="layui-row layui-col-space10">
					<div class="layui-col-xs6">
						<fieldset class="layui-elem-field">
							<legend>基本</legend>
							<div class="layui-field-box">
								<div id="view-basic"></div>
							</div>
						</fieldset>
					</div>

					<div class="layui-col-xs6">
						<fieldset class="layui-elem-field">
							<legend>内容</legend>
							<div class="layui-field-box">
								<div id="view-content"></div>
							</div>
						</fieldset>
					</div>

					<div class="layui-col-xs12">
						<fieldset class="layui-elem-field">
							<legend>信息</legend>
							<div class="layui-field-box">
								<div id="view-info"></div>
							</div>
						</fieldset>
					</div>
				</div>
				
			</div>
		</div>

		<script src="../../../component/layui/layui.js"></script>
		<script src="../../../component/pear/pear.js"></script>
		<script src="../../../lay-ext/dayjs.min.js"></script>



		<script type="text/javascript">
			// 加载自定义模块,检查浏览器和token
			layui.extend({
        myheader: "{/}/lay-ext/myheader",
      });
			
			
			layui.use(['form', 'jquery','myheader','layer','laytpl'], function() {
				let form = layui.form;
				let $ = layui.jquery;
				let myheader = layui.myheader;
				let layer = layui.layer;
				let laytpl = layui.laytpl;
				
				const viewBasicObj={}
				const viewContentObj={}
				const viewInfoObj={}
        // 定义全局 ajax的请求头
        myheader.ajaxGlobal(myheader.checkToken().tokenValue);

				// 获取父页的数据
				const fuData = layui.sessionData("fu2zi").fuData;
				
				// 清空父传子时临时用的session对象
        layui.sessionData("fu2zi", null);

				// 初始化,基本信息
				initPage1(fuData);
				// 初始化,内容信息
				initPage2(fuData);
				// 初始化,信息的部分
				initPage3(fuData);

				function initPage1(fuinfo){

					// 1.1 获取渲染人员相关
					// getUserInfo(fuinfo.userCode,fuinfo.userCodeEnd)
					viewBasicObj.beginUser = (fuinfo.startUser!=null?fuinfo.startUser.userFullName:'')
					viewBasicObj.endUser = (fuinfo.endUser!=null?fuinfo.endUser.userFullName:'')  
					// 1.2 机台信息
					viewBasicObj.machineNo= fuinfo.record.machineNo;
					// 1.3 机台列
					if(fuinfo.record.recordSelectedColNo != '' && fuinfo.record.recordSelectedColNo !=null){
						viewBasicObj.recordSelectedColNo=fuinfo.record.recordSelectedColNo
					}
					// 1.4 部位
					if(fuinfo.record.recordPart != '' && fuinfo.record.recordPart !=null){
						viewBasicObj.recordPart=fuinfo.record.recordPart
					}
					//1.5 开始时间
					if(fuinfo.record.recordTimeBeginDT!='' && fuinfo.record.recordTimeBeginDT !=null && fuinfo.record.recordTimeBeginDT !=0){
						viewBasicObj.recordTimeBeginDT= dayjs(fuinfo.record.recordTimeBeginDT).format('YYYY-MM-DD HH:mm:ss')
					}
					//1.6 结束时间
					if(fuinfo.record.recordTimeEndDT!='' && fuinfo.record.recordTimeEndDT !=null && fuinfo.record.recordTimeEndDT !=0){
						viewBasicObj.recordTimeEndDT= dayjs(fuinfo.record.recordTimeEndDT).format('YYYY-MM-DD HH:mm:ss')
					}
					// 渲染
					let getTpl = optionTpl1.innerHTML
					laytpl(getTpl).render(viewBasicObj,function(html){
						$("#view-basic").html(html)
					})
				}

				function initPage2(fuinfo){
					if(fuinfo.record.recordType!='' && fuinfo.record.recordType!=null){
						viewContentObj.recordType=fuinfo.record.recordType;
					}
					if(fuinfo.record.recordName!='' && fuinfo.record.recordName!=null){
						viewContentObj.recordName=fuinfo.record.recordName;
					}
					if(fuinfo.record.recordResult!='' && fuinfo.record.recordResult!=null){
						viewContentObj.recordResult=fuinfo.record.recordResult;
					}
					if(fuinfo.record.abnormalHandler!='' && fuinfo.record.abnormalHandler!=null){
						viewContentObj.abnormalHandler=fuinfo.record.abnormalHandler
					}
					if(fuinfo.record.recordRemark!='' && fuinfo.record.recordRemark!=null){
						viewContentObj.recordRemark=fuinfo.record.recordRemark
					}
					if(fuinfo.record.recordVerify!='' && fuinfo.record.recordVerify!=null){
						viewContentObj.recordVerify=fuinfo.record.recordVerify
					}
					// 渲染
					let getTpl = optionTpl2.innerHTML
					laytpl(getTpl).render(viewContentObj,function(html){
						$("#view-content").html(html)
					})

				}

				function initPage3(fuinfo){
					if(fuinfo.record.recordLotInfo!='' && fuinfo.record.recordLotInfo!=null){
						viewInfoObj.recordLotInfo=fuinfo.record.recordLotInfo;
					}
					if(fuinfo.record.recordAQRInfo!='' && fuinfo.record.recordAQRInfo!=null){
						viewInfoObj.recordAQRInfo=fuinfo.record.recordAQRInfo;
					}
					// 渲染
					let getTpl = optionTpl3.innerHTML
					laytpl(getTpl).render(viewInfoObj,function(html){
						$("#view-info").html(html)
					})

				}

				function getUserInfo(startUserCode,endUserCode){
					// 不为空时
					if(startUserCode!=null && startUserCode!='' && startUserCode!=0){
						$.ajax(parent.layui.myheader.baseUrl()+"/user/getUserCodeEcho",{
							type:'get',
							async:false,
							data:{
								userCode:startUserCode
							},
							success:function(res){
								if(res.code==200){
									viewBasicObj.beginUser= res.data.topDept.topDeptName + ' ' + res.data.user.userFullName
								}
								else {
									parent.layui.popup.failure(res.msg);
								}
							}
						})
					}
					if(endUserCode!=null && endUserCode!='' && endUserCode!=0){
						$.ajax(parent.layui.myheader.baseUrl()+"/user/getUserCodeEcho",{
							type:'get',
							async:false,
							data:{
								userCode:endUserCode
							},
							success:function(res){
								if(res.code==200){
									viewBasicObj.endUser= res.data.topDept.topDeptName + ' ' + res.data.user.userFullName
								}
								else {
									parent.layui.popup.failure(res.msg);
								}
							}
						})
					}

				}
				return


				// 注册作业属于的单选事件
				belong2Event()
				
				// 注册所属工程-下拉列表的选择事件
				belong2SecDSelectEvent()

				initEdit()

				


			

			
				
			})
		</script>
		<script id="optionTpl1" type="text/html">
			{{# if( typeof d.beginUser!== 'undefined' ) { }}
				<div style="padding-bottom:3px">
					<span>开始人员: {{=d.beginUser}}</span>
				</div>
			{{# } }}
			{{# if( typeof d.endUser!== 'undefined' ) { }}
				<div style="padding-bottom:3px">
					<span>结束人员: {{=d.endUser}}</span>
				</div>
			{{# } }}
			{{# if( typeof d.machineNo!== 'undefined' ) { }}
				<div style="padding-bottom:3px">
					<span>机台</span><span style="margin-left:28px">:  {{=d.machineNo}}</span>
				</div>
			{{# } }}
			{{# if( typeof d.recordSelectedColNo!== 'undefined' ) { }}
				<div style="padding-bottom:3px">
					<div class="layui-row">
						<div class="layui-col-xs4">
							<span>列</span>
						</div>
						<div class="layui-col-xs8">
							<ul>
								{{# layui.each(d.recordSelectedColNo.split(';'),function(index,item){ }}
									<li style="list-style: initial;">{{item}}</li>
								{{# })}}
							</ul>
						</div>
					</div>
				</div>
			{{# } }}
			{{# if( typeof d.recordPart!== 'undefined' ) { }}
				<div style="padding-bottom:3px">
					<div class="layui-row">
						<div class="layui-col-xs4">
							<span>部位</span>		
						</div>
						<div class="layui-col-xs8">
							<ul>
								{{# layui.each(d.recordPart.split(';'),function(index,item){ }}
									<li style="list-style: initial;">{{item}}</li>
								{{# })}}
							</ul>		
						</div>	
					</div>
					
				</div>
			{{# } }}
			{{# if( typeof d.recordTimeBeginDT!== 'undefined' ) { }}
				<div style="padding-bottom:3px">
					<span>开始时间: {{=d.recordTimeBeginDT}}</span>
				</div>
			{{# } }}
			{{# if( typeof d.recordTimeEndDT!== 'undefined' ) { }}
				<div style="padding-bottom:3px">
					<span>结束时间: {{=d.recordTimeEndDT}}</span>
				</div>
			{{# } }}	
		</script>

		<script id="optionTpl2" type="text/html">
			{{# console.log(d)}}
			{{# if( typeof d.recordType!== 'undefined' ) { }}
				<div style="padding-bottom:3px">
					<span>记录类型: {{=d.recordType}}</span>
				</div>
			{{# } }}
			{{# if( typeof d.recordName!== 'undefined' ) { }}
				<div style="padding-bottom:3px">
					<span>记录项目: {{=d.recordName}}</span>
				</div>
			{{# } }}
			{{# if( typeof d.recordResult!== 'undefined' ) { }}
				<div style="padding-bottom:3px">
					<div class="layui-row">
						<div class="layui-col-xs4">
							<span>记录结果:</span>
						</div>
						<div class="layui-col-xs8">
							<ul>
								{{# layui.each(d.recordResult.split(';'),function(index,item){ }}
									<li style="list-style: initial;">{{item}}</li>
								{{# })}}
							</ul>
						</div>
					</div>
					
				</div>
			{{# } }}
			{{# if( typeof d.abnormalHandler!== 'undefined' ) { }}
				<div style="padding-bottom:3px">
					<span>异常处置</span>
					<ul style="margin-left:60px">
						{{# layui.each(d.abnormalHandler.split(';'),function(index,item){ }}
							<li style="list-style: initial;">{{item}}</li>
						{{# })}}
					</ul>
				</div>
			{{# } }}
			{{# if( typeof d.recordRemark!== 'undefined' ) { }}
				<div style="padding-bottom:3px">
					<span>备注信息: {{=d.recordRemark}}</span>
				</div>
			{{# } }}
			{{# if( typeof d.recordVerify!== 'undefined' ) { }}
				<div style="padding-bottom:3px">
					<span>确认信息: {{=d.recordVerify}}</span>
				</div>
			{{# } }}
			</script>
		
			<script id="optionTpl3" type="text/html">
			{{# if(JSON.stringify(d)=='{}') { }}
				未记录
			{{# } }}
			{{# if( typeof d.recordLotInfo!== 'undefined' ) { }}
				<div style="padding-bottom:3px">
					<span>LOTNo: {{=d.recordLotInfo}}</span>
				</div>
			{{# } }}
			{{# if( typeof d.recordAQRInfo!== 'undefined' ) { }}
				<div style="padding-bottom:3px">
					<span>AQRx信息: {{=d.recordAQRInfo}}</span>
				</div>
			{{# } }}

		</script>
		
	</body>
</html>
